﻿using System;
using System.Runtime.InteropServices;

namespace QuotationService.RealtimeQuotation
{
    /// <summary>
    /// 市场信息
    /// </summary>
    [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
    internal struct MarketInfo
    {
        /// <summary>
        /// 市场时间与DB时间的偏差
        /// </summary>
        public TimeSpan MarketTime;

        /// <summary>
        /// 交易日
        /// </summary>
        public Int32 TradeDay;

        /// <summary>
        /// 市场信息更新时间
        /// </summary>
        public Int32 UpdateTime;

        /// <summary>
        /// 市场当前状态
        /// </summary>
        [MarshalAs(UnmanagedType.I2)]
        public MarketStatus Status;

        /// <summary>
        /// 交易时间段
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)]
        public string TradeTimeZone;

        /// <summary>
        /// 画图的区间段
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 72)]
        public string ChartTimeSlots;
    }


    /// <summary>
    /// 市场状态
    /// </summary>
    public enum MarketStatus : ushort
    {
        /// <summary>
        /// 已收盘
        /// </summary>
        Closed = 0,

        /// <summary>
        /// 已清盘
        /// </summary>
        Cleared = 1,
    }
	
}
